package com.hmjk.health.views;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;

public class ViewsPagerAdapter extends PagerAdapter {  
    protected List<View> mData;  
    //private SparseArray<View> mViews;  
  
    public ViewsPagerAdapter(List<View> data) {  
        mData = data;  
   //     mViews = new SparseArray<View>(data.size());  
    }  
  
    @Override  
    public int getCount() {  
        return mData.size();  
    }  
  
    @Override  
    public boolean isViewFromObject(View view, Object object) {  
        return view == object;  
    }  
  
    @Override  
    public Object instantiateItem(ViewGroup container, int position) {  
        View view = mData.get(position);  
        container.addView(view);  
        return view;  
    }  
  
    @Override  
    public void destroyItem(ViewGroup container, int position, Object object) {  
        container.removeView(mData.get(position));  
    }  
  
    public View getItem(int position) {  
        return mData.get(position);  
    }  
}  
